package com.ktjiaoyu.ktmall.servlet.api;

import com.alibaba.fastjson.JSON;
import com.ktjiaoyu.ktmall.utils.OSSUtil;
import com.ktjiaoyu.ktmall.utils.R;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

/**
 * @author xm
 * @date 2025/9/15
 * @Dome
 */
@WebServlet("/api/oss/policy")
public class OSSServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        resp.setContentType("application/json;charset=utf-8");
        PrintWriter out = resp.getWriter();
        out.write(JSON.toJSONString(R.ok(OSSUtil.getPolicy())));
        out.flush();
        out.close();
    }
}
